Optimal. Leaf size=161 \[ \frac {(a+2 b) \cot ^2(e+f x)}{2 a^3 f}-\frac {\cot ^4(e+f x)}{4 a^2 f}+\frac {\log (\cos (e+f x))}{(a-b)^2 f}+\frac {\left (a^2+2 a b+3 b^2\right ) \log (\tan (e+f x))}{a^4 f}+\frac {(4 a-3 b) b^3 \log \left (a+b \tan ^2(e+f x)\right )}{2 a^4 (a-b)^2 f}-\frac {b^3}{2 a^3 (a-b) f \left (a+b \tan ^2(e+f x)\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.13, antiderivative size = 161, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3751, 457, 90}
\begin {gather*} \frac {b^3 (4 a-3 b) \log \left (a+b \tan ^2(e+f x)\right )}{2 a^4 f (a-b)^2}-\frac {b^3}{2 a^3 f (a-b) \left (a+b \tan ^2(e+f x)\right )}+\frac {(a+2 b) \cot ^2(e+f x)}{2 a^3 f}-\frac {\cot ^4(e+f x)}{4 a^2 f}+\frac {\left (a^2+2 a b+3 b^2\right ) \log (\tan (e+f x))}{a^4 f}+\frac {\log (\cos (e+f x))}{f (a-b)^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 90
Rule 457
Rule 3751
Rubi steps
\begin {align*} \int \frac {\cot ^5(e+f x)}{\left (a+b \tan ^2(e+f x)\right )^2} \, dx &=\frac {\text {Subst}\left (\int \frac {1}{x^5 \left (1+x^2\right ) \left (a+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\text {Subst}\left (\int \frac {1}{x^3 (1+x) (a+b x)^2} \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=\frac {\text {Subst}\left (\int \left (\frac {1}{a^2 x^3}+\frac {-a-2 b}{a^3 x^2}+\frac {a^2+2 a b+3 b^2}{a^4 x}-\frac {1}{(a-b)^2 (1+x)}+\frac {b^4}{a^3 (a-b) (a+b x)^2}+\frac {(4 a-3 b) b^4}{a^4 (a-b)^2 (a+b x)}\right ) \, dx,x,\tan ^2(e+f x)\right )}{2 f}\\ &=\frac {(a+2 b) \cot ^2(e+f x)}{2 a^3 f}-\frac {\cot ^4(e+f x)}{4 a^2 f}+\frac {\log (\cos (e+f x))}{(a-b)^2 f}+\frac {\left (a^2+2 a b+3 b^2\right ) \log (\tan (e+f x))}{a^4 f}+\frac {(4 a-3 b) b^3 \log \left (a+b \tan ^2(e+f x)\right )}{2 a^4 (a-b)^2 f}-\frac {b^3}{2 a^3 (a-b) f \left (a+b \tan ^2(e+f x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.71, size = 121, normalized size = 0.75 \begin {gather*} -\frac {-\frac {(a+2 b) \cot ^2(e+f x)}{a^3}+\frac {\cot ^4(e+f x)}{2 a^2}-\frac {b^4}{a^4 (a-b) \left (b+a \cot ^2(e+f x)\right )}-\frac {(4 a-3 b) b^3 \log \left (b+a \cot ^2(e+f x)\right )}{a^4 (a-b)^2}-\frac {2 \log (\sin (e+f x))}{(a-b)^2}}{2 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.37, size = 217, normalized size = 1.35
method | result | size |
norman | \(\frac {-\frac {1}{4 a f}+\frac {\left (2 a +3 b \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{4 a^{2} f}+\frac {\left (-a^{2} b -a \,b^{2}+3 b^{3}\right ) b \left (\tan ^{6}\left (f x +e \right )\right )}{2 a^{4} f \left (a -b \right )}}{\tan \left (f x +e \right )^{4} \left (a +b \left (\tan ^{2}\left (f x +e \right )\right )\right )}+\frac {\left (a^{2}+2 a b +3 b^{2}\right ) \ln \left (\tan \left (f x +e \right )\right )}{a^{4} f}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f \left (a^{2}-2 a b +b^{2}\right )}+\frac {b^{3} \left (4 a -3 b \right ) \ln \left (a +b \left (\tan ^{2}\left (f x +e \right )\right )\right )}{2 a^{4} f \left (a^{2}-2 a b +b^{2}\right )}\) | \(199\) |
derivativedivides | \(\frac {-\frac {1}{16 a^{2} \left (\cos \left (f x +e \right )+1\right )^{2}}-\frac {-7 a -8 b}{16 a^{3} \left (\cos \left (f x +e \right )+1\right )}+\frac {\left (a^{2}+2 a b +3 b^{2}\right ) \ln \left (\cos \left (f x +e \right )+1\right )}{2 a^{4}}-\frac {1}{16 a^{2} \left (\cos \left (f x +e \right )-1\right )^{2}}-\frac {7 a +8 b}{16 a^{3} \left (\cos \left (f x +e \right )-1\right )}+\frac {\left (a^{2}+2 a b +3 b^{2}\right ) \ln \left (\cos \left (f x +e \right )-1\right )}{2 a^{4}}+\frac {b^{3} \left (\frac {a b}{\left (a -b \right )^{2} \left (a \left (\cos ^{2}\left (f x +e \right )\right )-\left (\cos ^{2}\left (f x +e \right )\right ) b +b \right )}+\frac {\left (4 a -3 b \right ) \ln \left (a \left (\cos ^{2}\left (f x +e \right )\right )-\left (\cos ^{2}\left (f x +e \right )\right ) b +b \right )}{\left (a -b \right )^{2}}\right )}{2 a^{4}}}{f}\) | \(217\) |
default | \(\frac {-\frac {1}{16 a^{2} \left (\cos \left (f x +e \right )+1\right )^{2}}-\frac {-7 a -8 b}{16 a^{3} \left (\cos \left (f x +e \right )+1\right )}+\frac {\left (a^{2}+2 a b +3 b^{2}\right ) \ln \left (\cos \left (f x +e \right )+1\right )}{2 a^{4}}-\frac {1}{16 a^{2} \left (\cos \left (f x +e \right )-1\right )^{2}}-\frac {7 a +8 b}{16 a^{3} \left (\cos \left (f x +e \right )-1\right )}+\frac {\left (a^{2}+2 a b +3 b^{2}\right ) \ln \left (\cos \left (f x +e \right )-1\right )}{2 a^{4}}+\frac {b^{3} \left (\frac {a b}{\left (a -b \right )^{2} \left (a \left (\cos ^{2}\left (f x +e \right )\right )-\left (\cos ^{2}\left (f x +e \right )\right ) b +b \right )}+\frac {\left (4 a -3 b \right ) \ln \left (a \left (\cos ^{2}\left (f x +e \right )\right )-\left (\cos ^{2}\left (f x +e \right )\right ) b +b \right )}{\left (a -b \right )^{2}}\right )}{2 a^{4}}}{f}\) | \(217\) |
risch | \(-\frac {6 i b^{2} x}{a^{4}}-\frac {6 i b^{2} e}{a^{4} f}-\frac {2 i e}{a^{2} f}-\frac {4 i b e}{a^{3} f}-\frac {2 i x}{a^{2}}-\frac {8 i b^{3} e}{a^{3} f \left (a^{2}-2 a b +b^{2}\right )}+\frac {6 i b^{4} x}{a^{4} \left (a^{2}-2 a b +b^{2}\right )}+\frac {i x}{a^{2}-2 a b +b^{2}}-\frac {8 i b^{3} x}{a^{3} \left (a^{2}-2 a b +b^{2}\right )}+\frac {6 i b^{4} e}{a^{4} f \left (a^{2}-2 a b +b^{2}\right )}-\frac {4 i b x}{a^{3}}-\frac {2 \left (2 a^{4} {\mathrm e}^{10 i \left (f x +e \right )}-4 a^{3} b \,{\mathrm e}^{10 i \left (f x +e \right )}+4 a \,b^{3} {\mathrm e}^{10 i \left (f x +e \right )}-3 b^{4} {\mathrm e}^{10 i \left (f x +e \right )}+2 a^{4} {\mathrm e}^{8 i \left (f x +e \right )}+2 a^{3} b \,{\mathrm e}^{8 i \left (f x +e \right )}-2 a^{2} b^{2} {\mathrm e}^{8 i \left (f x +e \right )}-10 a \,b^{3} {\mathrm e}^{8 i \left (f x +e \right )}+12 b^{4} {\mathrm e}^{8 i \left (f x +e \right )}-12 a^{3} b \,{\mathrm e}^{6 i \left (f x +e \right )}+12 a^{2} b^{2} {\mathrm e}^{6 i \left (f x +e \right )}+12 a \,b^{3} {\mathrm e}^{6 i \left (f x +e \right )}-18 b^{4} {\mathrm e}^{6 i \left (f x +e \right )}+2 a^{4} {\mathrm e}^{4 i \left (f x +e \right )}+2 a^{3} b \,{\mathrm e}^{4 i \left (f x +e \right )}-2 a^{2} b^{2} {\mathrm e}^{4 i \left (f x +e \right )}-10 a \,b^{3} {\mathrm e}^{4 i \left (f x +e \right )}+12 b^{4} {\mathrm e}^{4 i \left (f x +e \right )}+2 a^{4} {\mathrm e}^{2 i \left (f x +e \right )}-4 a^{3} b \,{\mathrm e}^{2 i \left (f x +e \right )}+4 a \,b^{3} {\mathrm e}^{2 i \left (f x +e \right )}-3 b^{4} {\mathrm e}^{2 i \left (f x +e \right )}\right )}{f \,a^{3} \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{4} \left (a -b \right )^{2} \left (a \,{\mathrm e}^{4 i \left (f x +e \right )}-b \,{\mathrm e}^{4 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}+2 b \,{\mathrm e}^{2 i \left (f x +e \right )}+a -b \right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )}{a^{2} f}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) b}{a^{3} f}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right ) b^{2}}{a^{4} f}+\frac {2 b^{3} \ln \left ({\mathrm e}^{4 i \left (f x +e \right )}+\frac {2 \left (a +b \right ) {\mathrm e}^{2 i \left (f x +e \right )}}{a -b}+1\right )}{a^{3} f \left (a^{2}-2 a b +b^{2}\right )}-\frac {3 b^{4} \ln \left ({\mathrm e}^{4 i \left (f x +e \right )}+\frac {2 \left (a +b \right ) {\mathrm e}^{2 i \left (f x +e \right )}}{a -b}+1\right )}{2 a^{4} f \left (a^{2}-2 a b +b^{2}\right )}\) | \(763\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.30, size = 242, normalized size = 1.50 \begin {gather*} \frac {\frac {2 \, {\left (4 \, a b^{3} - 3 \, b^{4}\right )} \log \left (-{\left (a - b\right )} \sin \left (f x + e\right )^{2} + a\right )}{a^{6} - 2 \, a^{5} b + a^{4} b^{2}} + \frac {2 \, {\left (2 \, a^{4} - 4 \, a^{3} b + 4 \, a b^{3} - 3 \, b^{4}\right )} \sin \left (f x + e\right )^{4} + a^{4} - 2 \, a^{3} b + a^{2} b^{2} - {\left (5 \, a^{4} - 7 \, a^{3} b - a^{2} b^{2} + 3 \, a b^{3}\right )} \sin \left (f x + e\right )^{2}}{{\left (a^{6} - 3 \, a^{5} b + 3 \, a^{4} b^{2} - a^{3} b^{3}\right )} \sin \left (f x + e\right )^{6} - {\left (a^{6} - 2 \, a^{5} b + a^{4} b^{2}\right )} \sin \left (f x + e\right )^{4}} + \frac {2 \, {\left (a^{2} + 2 \, a b + 3 \, b^{2}\right )} \log \left (\sin \left (f x + e\right )^{2}\right )}{a^{4}}}{4 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 360 vs.
\(2 (159) = 318\).
time = 1.30, size = 360, normalized size = 2.24 \begin {gather*} \frac {{\left (3 \, a^{4} b - 2 \, a^{3} b^{2} - 5 \, a^{2} b^{3} + 6 \, a b^{4}\right )} \tan \left (f x + e\right )^{6} - a^{5} + 2 \, a^{4} b - a^{3} b^{2} + {\left (3 \, a^{5} - 5 \, a^{3} b^{2} - 2 \, a^{2} b^{3} + 6 \, a b^{4}\right )} \tan \left (f x + e\right )^{4} + {\left (2 \, a^{5} - a^{4} b - 4 \, a^{3} b^{2} + 3 \, a^{2} b^{3}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left ({\left (a^{4} b - 4 \, a b^{4} + 3 \, b^{5}\right )} \tan \left (f x + e\right )^{6} + {\left (a^{5} - 4 \, a^{2} b^{3} + 3 \, a b^{4}\right )} \tan \left (f x + e\right )^{4}\right )} \log \left (\frac {\tan \left (f x + e\right )^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left ({\left (4 \, a b^{4} - 3 \, b^{5}\right )} \tan \left (f x + e\right )^{6} + {\left (4 \, a^{2} b^{3} - 3 \, a b^{4}\right )} \tan \left (f x + e\right )^{4}\right )} \log \left (\frac {b \tan \left (f x + e\right )^{2} + a}{\tan \left (f x + e\right )^{2} + 1}\right )}{4 \, {\left ({\left (a^{6} b - 2 \, a^{5} b^{2} + a^{4} b^{3}\right )} f \tan \left (f x + e\right )^{6} + {\left (a^{7} - 2 \, a^{6} b + a^{5} b^{2}\right )} f \tan \left (f x + e\right )^{4}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 685 vs.
\(2 (159) = 318\).
time = 1.11, size = 685, normalized size = 4.25 \begin {gather*} \frac {\frac {32 \, {\left (4 \, a b^{3} - 3 \, b^{4}\right )} \log \left (a + \frac {2 \, a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {4 \, b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {a {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}{a^{6} - 2 \, a^{5} b + a^{4} b^{2}} - \frac {64 \, \log \left ({\left | -\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1 \right |}\right )}{a^{2} - 2 \, a b + b^{2}} - \frac {32 \, {\left (4 \, a^{2} b^{3} - 3 \, a b^{4} + \frac {8 \, a^{2} b^{3} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {18 \, a b^{4} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {8 \, b^{5} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {4 \, a^{2} b^{3} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} - \frac {3 \, a b^{4} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}}{{\left (a^{6} - 2 \, a^{5} b + a^{4} b^{2}\right )} {\left (a + \frac {2 \, a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {4 \, b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {a {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )}} + \frac {32 \, {\left (a^{2} + 2 \, a b + 3 \, b^{2}\right )} \log \left (\frac {{\left | -\cos \left (f x + e\right ) + 1 \right |}}{{\left | \cos \left (f x + e\right ) + 1 \right |}}\right )}{a^{4}} - \frac {\frac {12 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {16 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}}{a^{4}} - \frac {{\left (a^{2} + \frac {12 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {16 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {48 \, a^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {96 \, a b {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}} + \frac {144 \, b^{2} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}{{\left (\cos \left (f x + e\right ) + 1\right )}^{2}}\right )} {\left (\cos \left (f x + e\right ) + 1\right )}^{2}}{a^{4} {\left (\cos \left (f x + e\right ) - 1\right )}^{2}}}{64 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 12.37, size = 191, normalized size = 1.19 \begin {gather*} \frac {\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (2\,a+3\,b\right )}{4\,a^2}-\frac {1}{4\,a}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^4\,\left (a^2\,b+a\,b^2-3\,b^3\right )}{2\,a^3\,\left (a-b\right )}}{f\,\left (b\,{\mathrm {tan}\left (e+f\,x\right )}^6+a\,{\mathrm {tan}\left (e+f\,x\right )}^4\right )}-\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )}{2\,f\,{\left (a-b\right )}^2}+\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )\right )\,\left (a^2+2\,a\,b+3\,b^2\right )}{a^4\,f}+\frac {\ln \left (b\,{\mathrm {tan}\left (e+f\,x\right )}^2+a\right )\,\left (4\,a\,b^3-3\,b^4\right )}{f\,\left (2\,a^6-4\,a^5\,b+2\,a^4\,b^2\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________